import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SendMessageVO, SendMessageForm, SendMessageQuery } from '@/api/system/sendMessage/types';

/**
 * 查询短信列表
 * @param query
 * @returns {*}
 */

export const listSendMessage = (query?: SendMessageQuery): AxiosPromise<SendMessageVO[]> => {
  return request({
    url: '/system/sendMessage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询短信详细
 * @param messageId
 */
export const getSendMessage = (messageId: string | number): AxiosPromise<SendMessageVO> => {
  return request({
    url: '/system/sendMessage/' + messageId,
    method: 'get'
  });
};

/**
 * 新增短信
 * @param data
 */
export const addSendMessage = (data: SendMessageForm) => {
  return request({
    url: '/system/sendMessage',
    method: 'post',
    data: data
  });
};

/**
 * 修改短信
 * @param data
 */
export const updateSendMessage = (data: SendMessageForm) => {
  return request({
    url: '/system/sendMessage',
    method: 'put',
    data: data
  });
};

/**
 * 删除短信
 * @param messageId
 */
export const delSendMessage = (messageId: string | number | Array<string | number>) => {
  return request({
    url: '/system/sendMessage/' + messageId,
    method: 'delete'
  });
};